#!/bin/bash

# this is an sample shell script
# you will need to develop this to 
# complete the assignment for week 7
# scores less then 40 = Component Fail
# scores less then 50 = Fail
# scores between 50 and 80 = Pass
# scores between 80 and 100 = Pass with distinction
# All other scores = Invalid Input

#I will test (-1 -1)(39,39)(40,40)(50,50)(80,80)(100 100)

passed=0
failed=0
echo -----------------------------------
echo "Test Case 1: Testing -1/-1..."

tc=`java -jar Grades_v2.jar -1 -1`
echo Expected result =  "Invalid Input"
echo Result = $tc

if [ "$tc" = "Invalid Input" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------


echo -----------------------------------
echo "Test Case 1: Testing 39/39..."

tc=`java -jar Grades_v2.jar 39 39`
echo Expected result =  "Component Fail"
echo Result = $tc

if [ "$tc" = "Component Fail" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------

echo -----------------------------------
echo "Test Case 1: Testing 40/40..."

tc=`java -jar Grades_v2.jar 40 40`
echo Expected result =  "Fail"
echo Result = $tc

if [ "$tc" = "Fail" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------


echo -----------------------------------
echo "Test Case 1: Testing 50/50"

tc=`java -jar Grades_v2.jar 50 50`
echo Expected result =  "Pass"
echo Result = $tc

if [ "$tc" = "Pass" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------


echo -----------------------------------
echo "Test Case 1: Testing 80/80..."

tc=`java -jar Grades_v2.jar 80 80`
echo Expected result =  "Pass with distinction"
echo Result = $tc

if [ "$tc" = "Pass with distinction" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------

echo -----------------------------------
echo "Test Case 1: Testing 100/100..."

tc=`java -jar Grades_v2.jar 100 100`
echo Expected result =  "Pass with distinction"
echo Result = $tc

if [ "$tc" = "Pass with distinction" ]
  then
  echo "Test Passed"
((passed++))
 else 
echo "Test Failed"
((failed++))
fi

echo -------------------------------------------


echo failed = $failed
echo passed = $passed


